{
 "cells": [
  {
   "cell_type": "markdown",
   "metadata": {},
   "source": [
    "# Linear Regression Workshop"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 2,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import numpy as np"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "import tensorflow as tf"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# Step 1- import data\n",
    "\n",
    "points = np.genfromtxt('data.csv', delimiter=',')\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 10,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "# separate out data\n",
    "x = points[:,0]\n",
    "y = points[:,1]"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 12,
   "metadata": {
    "collapsed": false
   },
   "outputs": [],
   "source": [
    "import matplotlib.pyplot as plt\n",
    "%matplotlib inline"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 13,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAGqtJREFUeJzt3X+MXeV95/H3l2FCBrrNQBlZZhzXdIVsJXGDm9mElqrC\n/KhZJQ2WI6WgpXLbXVmVojatuk5tteovJbUlV9rmn1ZC6Q8ksiRsoIYmalxqQJXQmmicSesQPEu0\ngGH4YbfEqRqmiTHf/nHP4OuZc+899/x8znM+L8mauWfu3HnuGc/3PM/3+T7PMXdHRETidUnTDRAR\nkWop0IuIRE6BXkQkcgr0IiKRU6AXEYmcAr2ISOQU6EVEIqdALyISOQV6EZHIXdp0AwCuvvpq37Rp\nU9PNEBFplePHj/+zu8+Mel4QgX7Tpk3Mz8833QwRkVYxsxeyPE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ysB+ko+cCeAl4KRntAnyJXuDv6vmAXgfg6+7+WvK4tnOhQD8m\nM5sxs+nk8yngNuAk8AiwO3nabuDhZlpYH3ff7+4b3H0TvSHpY+5+Nx08F2Z2hZn9p5XP6eViv0kH\nzwWAu78KvGhmK3e6vwX4Fh09H4m7uJC2gRrPhRZMjcnMfhy4F5igd6F8wN3/0Mx+BHgA2EhvJ86P\nu/vrzbW0XmZ2E/A/3f0jXTwXZvZj9Hrx0Etb/G93/0wXz8UKM7se+BzwDuD/A79E8jdDx85HcvE/\nBfyYu383OVbb/w0FehGRyCl1IyISOQV6EZHIKdCLiEROgV5EJHIK9CIikVOgFxGJnAK9iEjkFOhF\nRCL3H8N3RG/c3uC4AAAAAElFTkSuQmCC\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x114a5e518>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x,y)\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 17,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# randomly initialize weights and biases\n",
    "\n",
    "slope = tf.Variable([1], dtype=tf.float32)\n",
    "intercept = tf.Variable([0], dtype=tf.float32)\n"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 36,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# define hyper parameter\n",
    "rate = 0.000001\n",
    "num_iterations = 1000"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 37,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# define data placeholders\n",
    "\n",
    "x_val = tf.placeholder(tf.float32)\n",
    "y_val = tf.placeholder(tf.float32)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 38,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# define the model\n",
    "\n",
    "predicted_y = slope*x_val + intercept"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 39,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# find your error\n",
    "\n",
    "error = tf.reduce_sum(tf.square(predicted_y - y_val))"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 40,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# find grdient and update weights\n",
    "\n",
    "optimizer = tf.train.GradientDescentOptimizer(learning_rate=rate)\n",
    "\n",
    "# minimize the error\n",
    "train = optimizer.minimize(error)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 41,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# initialize tf session\n",
    "\n",
    "sess = tf.Session()\n",
    "\n",
    "# initialize only the variables\n",
    "\n",
    "init = tf.global_variables_initializer()\n",
    "\n",
    "sess.run(init)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 42,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "# train your model for certain number of iterations\n",
    "\n",
    "for p in range(num_iterations):\n",
    "    \n",
    "    sess.run(train, feed_dict={x_val:x, y_val:y})"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 43,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 1.47812736], dtype=float32)"
      ]
     },
     "execution_count": 43,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sess.run(slope)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 44,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.06943748], dtype=float32)"
      ]
     },
     "execution_count": 44,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "sess.run(intercept)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 45,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "def predict(m,b,x_vals):\n",
    "    \n",
    "    ys = []\n",
    "    \n",
    "    for i in range(len(x_vals)):\n",
    "        \n",
    "        predicted_y = m*x_vals[i]+b\n",
    "        ys.append(predicted_y)\n",
    "        \n",
    "    return ys"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 46,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": [
    "final_predicted_slope = sess.run(slope)\n",
    "final_predicted_intercept = sess.run(intercept)"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 47,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "array([ 0.06943748], dtype=float32)"
      ]
     },
     "execution_count": 47,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "final_predicted_intercept"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 48,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "image/png": "iVBORw0KGgoAAAANSUhEUgAAAXoAAAD8CAYAAAB5Pm/hAAAABHNCSVQICAgIfAhkiAAAAAlwSFlz\nAAALEgAACxIB0t1+/AAAIABJREFUeJzt3XucFOWd7/HPj2GAAQ0DgUUcxdEkQqIoxMkVV0GDaHAj\nBxNMzkleJjEvTjaaxMRLhk2MuUiYDZ7E7DmarJubu16JGkQnCRoummBAZxgQL+CN68jNVdTIgDA8\n54/plp6p6nt1d1X19/168WLm6Zruh2rm28/zq6eqzDmHiIjEV79Kd0BEREpLQS8iEnMKehGRmFPQ\ni4jEnIJeRCTmFPQiIjGnoBcRiTkFvYhIzCnoRURirn+lOwAwYsQI19jYWOluiIhESnt7+8vOuZHZ\ntgtF0Dc2NtLW1lbpboiIRIqZbc5lO5VuRERiLmvQm9mvzWyXmT2Z0jbfzNab2RNm9nszq095bI6Z\nPW9mG8xsWqk6LiIiucllRP9b4Nw+bQ8BJzvnTgGeBeYAmNn7gE8DJyV+5iYzqwmstyIikresQe+c\newR4pU/bg865g4lvVwLHJL6+ALjTObffObcReB74YID9FRGRPAVRo/8i8MfE1w3A1pTHtiXaRESk\nQopadWNm3wYOArcV8LOzgdkAY8aMKaYbIiJ5WdjRyfzFG3hpTxdH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LEG2AU85JxbBYxyzm1PbLIDGFWxDpbXDcDVwKGUtmrdFw74s5m1m9ns\nRFu17ovjgd3AbxJlvV+a2RCqd38kfRq4I/F12faFgr4Azrlu1zMNOwb4oJmd3OdxR88vfayZ2fnA\nLudce7ptqmVfJJye+H9xHnCpmZ2R+mCV7Yv+wPuBnzvnJgJv0qc0UWX7AzMbAHwC+F3fx0q9LxT0\nRXDO7QGWAecCO81sNEDi712V7FuZTAI+YWabgDuBs8zsVqpzX+Cc60z8vYueGuwHqdJ9AWwDtiVm\nuwB30xP81bo/oGcAsNo5tzPxfdn2hYI+T2Y20szqE1/XAVOB9cAi4OLEZhcD91Wmh+XjnJvjnDvG\nOddIz5R0qXPus1ThvjCzIWZ2ZPJremqxT1KF+wLAObcD2GpmyTvdnw08TZXuj4TPcLhsA2XcFzph\nKk9mdgpwC1BDzwflAufcD8zsncACYAw9V+Kc5Zx7pXI9LS8zmwxc6Zw7vxr3hZmdQM8oHnrKFrc7\n5+ZW475IMrMJwC+BAcCLwBdI/M5QZfsj8eG/BTjBOfdaoq1s/zcU9CIiMafSjYhIzCnoRURiTkEv\nIhJzCnoRkZhT0IuIxJyCXkQk5hT0IiIxp6AXEYm5/w/OjmZhNMgRsQAAAABJRU5ErkJggg==\n",
      "text/plain": [
       "<matplotlib.figure.Figure at 0x114f0a128>"
      ]
     },
     "metadata": {},
     "output_type": "display_data"
    }
   ],
   "source": [
    "plt.scatter(x,y)\n",
    "plt.plot(x, predict(final_predicted_slope, final_predicted_intercept,x))\n",
    "plt.show()"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 50,
   "metadata": {
    "collapsed": false
   },
   "outputs": [
    {
     "data": {
      "text/plain": [
       "[array([ 96.14771271], dtype=float32)]"
      ]
     },
     "execution_count": 50,
     "metadata": {},
     "output_type": "execute_result"
    }
   ],
   "source": [
    "predict(final_predicted_slope, final_predicted_intercept, [65])"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "metadata": {
    "collapsed": true
   },
   "outputs": [],
   "source": []
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.5.2"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 2
}
